
file = '山东省分县月降水量短期气候趋势预测结果.TXT'
#从文件中读取齐河的行
def duqu_qihe_neirong(filename):
    lines = []
    with open(filename, 'r') as fr:
        for line in fr:
            if line.startswith('齐河'):
                # line = line.rstrip('\n')
                lines.append(line)
    return lines

#将读取出来的齐河数据存到新文件
with open('qihe_shujv.txt', 'w') as fw:
    for line in duqu_qihe_neirong(file):
        fw.write(line)


